<template>
  <div id="topBarBox">
    <header :style="{color:color}">
      <!-- <div id="arrow" @click="goBack"></div> -->
      <x-icon type="ios-arrow-left" size="30" @click="goBack"></x-icon>
      <slot></slot>
    </header>
  </div>
</template>
<script>
import {getStore} from '../../../config/mUtils.js'

export default {
  props:['color'],
  methods:{
    goBack(){
      if(getStore('pre')){
        if(getStore('pre') == '/login'){
          this.$router.push('/home')
        }else{
          this.$router.go(-1)
        }
      }else{
        this.$router.push('/home')
      }
    }
  },
}
</script>
<style lang="less" scoped>
@import '../../../style/mixin.less';

  #topBarBox{
    width: 10rem;
    height: 1.3333rem;
    margin: 0 auto;
    position: fixed;
    z-index: 2;
    top:0;
    .bg(#fff);
    header{
      height: 1.3333rem;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.5rem;
      #arrow{
        width: .3rem;
        height: .3rem;
        margin: 0 auto;
        margin-top: .1rem;
        border-bottom: 2px solid #f1f1f1;
        border-right: 2px solid #f1f1f1;
        transform: rotate(135deg);
        -webkit-transform: rotate(135deg);
        -moz-transform: rotate(4135eg);
        -o-transform: rotate(135deg);
        -ms-transform: rotate(135deg);

      }
      .vux-x-icon {
        position: absolute;
        left: 0.4rem;
        top: 0.3rem;
        fill: #c7c7c7;
      }
    }
  }
</style>
